#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QAction>
#include <QMenu>
#include <QToolBar>
#include <QDebug>
#include <QFileDialog>
#include <QImage>
#include <QMessageBox>
#include <QScrollArea>
#include <QPalette>
#include <QLabel>
#include <QGridLayout>
#include <QPaintEvent>
#include <QSize>
#include <QMouseEvent>
#include <QPoint>
#include <algorithm>
#include <QCloseEvent>
#include <QTextCodec>
#include <QInputDialog>
#include "status.h"
#include "utility.h"
#include "paintarea.h"
#include "QColorDialog"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

protected:
    void closeEvent(QCloseEvent *event);

private slots:
    // 槽信号响应
    void on_openAction_triggered();

    void on_saveAction_triggered();

    void on_exitAction_triggered();

    void on_pointAction_triggered();

    void on_rectAction_triggered();

    void on_polyAction_triggered();

    void on_zoomInAction_triggered();

    void on_zoomOutAction_triggered();

    void on_nextAction_triggered();

    void on_previousAction_triggered();

    void on_clearAction_triggered();

    void on_action_2_triggered();

    void on_action_N_triggered();

    void on_comboBox_currentIndexChanged(int index);

    void on_chooseColorAction_triggered();

private:
    Ui::MainWindow *ui;
    // 显示图片的label
    PaintArea *label;
    QImage img;
    Status *pStatus = nullptr;
    // 根据目录和文件返回文件在目录中的索引
    int getFileIndex(const string &directoryPath, const string &file);
    void commonFunction(int index);
    void setComboBox();
};

#endif // MAINWINDOW_H
